import React from 'react';
import { Menu } from 'antd';
import { page } from '../../route/list';
import { useNavigate, useLocation } from 'react-router-dom';

const { Item } = Menu;

export default function index() {

    const navigate = useNavigate()
    const { pathname } = useLocation()

    return (
        <Menu
            theme='dark'
            defaultSelectedKeys={[pathname]}
            onClick={({ key }) => { navigate(key) }}>
            {
                page.map((v) => {
                    return <Item key={v.path} icon={v.icon}>{v.lable}</Item>
                })
            }
        </Menu>
    )
}
